package main

func integerBreak(n int) int {
	cache = make(map[int]int)
	return intBreak(n)
}

var cache map[int]int

func intBreak(n int) int {
	if n == 1 || n == 2 {
		return 1
	}
	if v, ok := cache[n]; ok {
		return v
	}
	max := 1
	for i := 1; i < n; i++ {
		v := i * intBreak(n-i)
		if i*(n-i) > v {
			v = i * (n - i)
		}
		if v > max {
			max = v
		}
	}
	cache[n] = max
	return max
}

func main() {
	println(integerBreak(10))
}
